package com.carreirati.evaluation;

import com.carreirati.evaluation.domain.VwGetEvaluationResultsByQuestion;
import com.carreirati.evaluation.domain.VwGetEvaluationResultsByQuestionPK;
import com.carreirati.evaluation.domain.VwGetEvaluationResultsByQuestionParameter;

import java.util.List;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.roo.addon.web.mvc.controller.json.RooWebJson;
import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/vwgetevaluationresultsbyquestions")
@Controller
@RooWebScaffold(path = "vwgetevaluationresultsbyquestions", formBackingObject = VwGetEvaluationResultsByQuestion.class)
@RooWebJson(jsonObject = VwGetEvaluationResultsByQuestion.class)
public class VwGetEvaluationResultsByQuestionController {
	 
	    @RequestMapping(value = "/find{appraisalId}", headers = "Accept=application/json")
	    @ResponseBody
	    public ResponseEntity<java.lang.String> findJson(@PathVariable("appraisalId") long appraisalId) {
	    	
	    	
	    	HttpHeaders headers = new HttpHeaders();
	        headers.add("Content-Type", "application/json; charset=utf-8");
	        List<VwGetEvaluationResultsByQuestion> result = VwGetEvaluationResultsByQuestion.findAllVwGetEvaluationResultsByQuestions(appraisalId);
	        return new ResponseEntity<String>(VwGetEvaluationResultsByQuestion.toJsonArray(result), headers, HttpStatus.OK);
	    }
}
